package com.javabasic2.paintclient;

import java.awt.Color;
import java.awt.Graphics;

public class DrawPaint {
	private int x, y, s;
	private int style;
	private Color color;
	
	public DrawPaint(){}
	public DrawPaint(int x, int y, int s, int style, Color color) {
		setPoint( x, y, s, style, color);
	}
	public void setPoint(int x, int y, int s, int style, Color color) {
		this.x = x;
		this.y = y;
		this.s = s;
		this.style = style;
		this.color = color;
	}
	public int getS() {
		return s;
	}
	public void setS(int s) {
		this.s = s;
	}
	public int getX() {
		return x;
	}
	public void setX(int x) {
		this.x = x;
	}
	public int getY() {
		return y;
	}
	public void setY(int y) {
		this.y = y;
	}
	public int getStyle() {
		return style;
	}
	public void setStyle(int style) {
		this.style = style;
	}
	public Color getColor() {
		return color;
	}
	public void setColor(Color color) {
		this.color = color;
	}
	public void delete() {
		this.x = 0;
		this.y = 0;
		this.s = 0;
		this.style = 0;
		this.color = Color.WHITE;
	}
	public void draw(Graphics g, DrawPaint pPoint) {

		int sizeX= 0, sizeY = 0;
		sizeX = (int)Math.abs(pPoint.getX() - getX());
		sizeY = (int)Math.abs(pPoint.getY() - getY());
		
		switch(style) {
		case 1:  
			g.drawLine(pPoint.getX(), pPoint.getY(), getX(), getY());
			break;
		case 2:  
			g.drawRect((pPoint.getX()+getX())/2 - sizeX/2,
					(pPoint.getY()+getY())/2 - sizeY/2,
					sizeX, sizeY);
			break;
		case 3:  
			g.drawOval((pPoint.getX()+getX())/2 - sizeX/2,
					(pPoint.getY()+getY())/2 - sizeY/2,
					sizeX, sizeY);
			break;
			default :
				break;
		}
		g.setColor(getColor());
		
		if(getStyle() != 0 && getStyle() != 9){
		}
	}
	
}
